﻿<base:PageBase
    xmlns:base="using:Daphne.Modularity.UI"
    x:Class="Daphne.PagesMetro.Pages.EditorPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Daphne.PagesMetro.Pages"
    xmlns:b2="using:Daphne.Board2DMetro"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    x:Name="root"
    mc:Ignorable="d">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ms-appx:///PagesMetro/Themes/EditorTheme.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
<Page.Transitions>
        <TransitionCollection>
            <PaneThemeTransition  />
        </TransitionCollection>
    </Page.Transitions>
    <Border Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Padding="30" BorderThickness="0">
        <Grid>        
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />                
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            
            <!-- Header -->
            <StackPanel Grid.Row="0" >
                <TextBlock FontSize="48" FontWeight="Bold">Editor pozic</TextBlock>
                <Button x:Name="uxBack" Height="48" HorizontalAlignment="Left" Command="{Binding Path=CancelEditingCommand}" >Zpět</Button>
            </StackPanel>
            
            <!-- Content -->
            <Grid Grid.Row="1"  Margin="0,10,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition Width="1*" />
                </Grid.ColumnDefinitions>                
           
                <!-- GameBoard -->            
                <Viewbox Grid.Column="0" >
                    <b2:Board2DControl x:Name="uxBoard" EditMode="True"  FieldTappedCommand="{Binding Path=FieldTappedCommand}" />
                </Viewbox>

                <!-- Control Panel -->
                <Viewbox Grid.Column="1" VerticalAlignment="Top">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Border Grid.Row="0"  Style="{StaticResource uxBorderStyle}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <RadioButton Grid.Column="0" GroupName="Figures" IsChecked="{Binding Path=WhiteFiguresChecked, Mode=TwoWay}" >Bílé figury</RadioButton>
                                <RadioButton Grid.Column="1" GroupName="Figures" IsChecked="{Binding Path=BlackFiguresChecked, Mode=TwoWay}" >Černé figury</RadioButton>
                            </Grid>
                        </Border>

                        <Border Grid.Row="1"  Style="{StaticResource uxBorderStyle}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <Button Grid.Column="0" Command="{Binding Path=UndoCommand}" >Zpět</Button>
                                <Button Grid.Column="1"  Command="{Binding Path=RedoCommand}">Opakovat</Button>
                            </Grid>
                        </Border>

                        <Border Grid.Row="2" Style="{StaticResource uxBorderStyle}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <Button Grid.Column="0" Command="{Binding Path=SetStartPositionCommand}" >Zahájení</Button>
                                <Button Grid.Column="1" Command="{Binding Path=ClearBoardCommand}" >Vymazat</Button>
                            </Grid>
                        </Border>

                        <Border Grid.Row="3"  Style="{StaticResource uxBorderStyle}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <RadioButton Grid.Column="0" GroupName="STM" IsChecked="{Binding Path=WhiteSTM, Mode=TwoWay}" >Na tahu bílý</RadioButton>
                                <RadioButton Grid.Column="1" GroupName="STM" IsChecked="{Binding Path=BlackSTM, Mode=TwoWay}" >Na tahu černý</RadioButton>
                            </Grid>
                        </Border>

                        <Button Grid.Row="4"  Width="200" Command="{Binding Path=AcceptPositionCommand}" >Akceptovat pozici</Button>
                    </Grid>
                </Viewbox>

            </Grid>
        </Grid>
    </Border>
</base:PageBase>
